//
//  BroadCast.m
//  notificationDemo
//
//  Created by zhouxiaobo on 15/10/28.
//  Copyright © 2015年 mapath. All rights reserved.
//

#import "BroadCast.h"


static BroadCast *broadCast = nil;
@implementation BroadCast

+(BroadCast *) shardeBroadCast{
    @synchronized(self) {
        if(broadCast == nil){
            broadCast = [[[self class]alloc]init];
        }

    }
    return broadCast;
}

-(void) sendMessage {
    //发送数据
    NSDictionary *dict = @{@"userId":@"123",@"userName":@"zhouxiaobo"};
    
    //1. 获得当前系统的通知中心
    NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
    
    //2. 发送广播
    [center postNotificationName:@"fm104.75" object:self userInfo:dict];
}

-(void) repeatSendMessage {
    [NSTimer scheduledTimerWithTimeInterval:1.0f target:self selector:@selector(sendMessage) userInfo:nil repeats:TRUE];
}


@end
